package com.idp.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.*;

/**
 * @Author JTR -H
 * @Address BS_221
 * @Created_Date 2021/7/30 - 10:47
 */
public class JTRStaticUtils {

    // 提供的IdP账户id; 在数据库中存储的权限越靠前,优先级越高
    private final static String[] IDP_STRINGS = {
            "odder", "green", "red"
    };

    // key: IdP用户权限(数据库存储的authorities) --> value: 华为云.统一认证服务.身份提供商 授权过的IdP账号id
    private final static Map<String, String> IDP_AUTHS_MAP = new HashMap<>();

    public static final String enterpriseSystemLoginURL = "127.0.0.1:4567/login";

    public static final String X_USER_ID = "xUserId";

    static {
        IDP_AUTHS_MAP.put("admin", "odder");
        IDP_AUTHS_MAP.put("green", "green");
        IDP_AUTHS_MAP.put("red", "red");
    }

    public static String[] getIdpStrings() {
        return IDP_STRINGS;
    }

    public static Map<String, String> getIdpAuthsMap() {
        return IDP_AUTHS_MAP;
    }
}


/*
 ******************************************************
 *    Eliminate all impossible,                       *
 *    remain that although or else can be thought of, *
 *    discuss,                                        *
 *    that also is a fact.                            *
 ******************************************************
 */
